package users

import "yundian/internel/pkg/dingo"

type UserAttr func(model *UserModel)

type UserAttrs []UserAttr

func (attrFunc UserAttrs) Apply(model *UserModel) {
	for _, f := range attrFunc {
		f(model)
	}
}

func WithId(id int) UserAttr {
	return func(model *UserModel) { model.ID = id }
}

func WithName(name string) UserAttr {
	return func(model *UserModel) { model.Name = name }
}

func WithUserName(userName string) UserAttr {
	return func(model *UserModel) { model.UserName = userName }
}

func WithNickName(nickName string) UserAttr {
	return func(model *UserModel) { model.NickName = nickName }
}

func WithPassword(password string) UserAttr {
	return func(model *UserModel) { model.Password = password }
}

func WithPhone(phone string) UserAttr {
	return func(model *UserModel) { model.Phone = phone }
}

func WithPhoneCode(phoneCode string) UserAttr {
	return func(model *UserModel) { model.PhoneCode = phoneCode }
}

func WithRoleId(roleId int) UserAttr {
	return func(model *UserModel) { model.RoleID = roleId }
}

func WithParentId(parentId int) UserAttr {
	return func(model *UserModel) { model.ParentID = parentId }
}

func WithIsAdmin(isAdmin uint8) UserAttr {
	return func(model *UserModel) { model.IsAdmin = isAdmin }
}

func WithIsDraw(isDraw uint8) UserAttr {
	return func(model *UserModel) { model.IsDraw = isDraw }
}

func WithIsCash(isCash uint8) UserAttr {
	return func(model *UserModel) { model.IsCash = isCash }
}

func WithIsPlace(isPlace uint8) UserAttr {
	return func(model *UserModel) { model.IsPlace = isPlace }
}

func WithProfitType(profitType int) UserAttr {
	return func(model *UserModel) { model.ProfitType = profitType }
}

func WithProfitIsVisible(profitIsVisible int) UserAttr {
	return func(model *UserModel) { model.ProfitIsVisible = profitIsVisible }
}

func WithOrderIsVisible(orderIsVisible int) UserAttr {
	return func(model *UserModel) { model.OrderIsVisible = orderIsVisible }
}

func WithIncomeIsVisible(incomeIsVisible int) UserAttr {
	return func(model *UserModel) { model.IncomeIsVisible = incomeIsVisible }
}

func WithProfitProportion(profitProportion int) UserAttr {
	return func(model *UserModel) { model.ProfitProportion = profitProportion }
}

func WithSmProfitProportion(smProfitProportion int) UserAttr {
	return func(model *UserModel) { model.SmProfitProportion = smProfitProportion }
}

func WithLastLoginIp(lastLoginIp string) UserAttr {
	return func(model *UserModel) { model.LastLoginIp = lastLoginIp }
}

func WithLastLoginTime(lastLoginTime dingo.Time) UserAttr {
	return func(model *UserModel) { model.LastLoginTime = lastLoginTime }
}

func WithStatus(status uint8) UserAttr {
	return func(model *UserModel) { model.Status = status }
}

func WithCreateAt(createAt dingo.Time) UserAttr {
	return func(model *UserModel) { model.CreateAt = createAt }
}

func WithUpdateAt(updateAt dingo.Time) UserAttr {
	return func(model *UserModel) { model.UpdateAt = updateAt }
}

func WithUserNo(userNo string) UserAttr {
	return func(model *UserModel) { model.UserNo = userNo }
}

func WithBranchUserId(branchUserId int) UserAttr {
	return func(model *UserModel) { model.BranchUserId = branchUserId }
}

func WithUserLevel(userLevel string) UserAttr {
	return func(model *UserModel) { model.UserLevel = userLevel }
}

func WithIsDivinds(isDivinds uint8) UserAttr {
	return func(model *UserModel) { model.IsDivinds = isDivinds }
}

func WithIsDividendsSm(DividendsSm uint8) UserAttr {
	return func(model *UserModel) { model.IsDividendsSm = DividendsSm }
}

func WithTaxRate(TaxRate uint8) UserAttr {
	return func(model *UserModel) { model.TaxRate = TaxRate }
}
func WithTaxRateRoom(TaxRateRoom float32) UserAttr {
	return func(model *UserModel) { model.TaxRateRoom = TaxRateRoom }
}
func WithTaxRateGoods(TaxRateGoods float32) UserAttr {
	return func(model *UserModel) { model.TaxRateGoods = TaxRateGoods }
}
func WithTaxRateAutomate(TaxRateAutomate float32) UserAttr {
	return func(model *UserModel) { model.TaxRateAutomate = TaxRateAutomate }
}

func WithProvince(province string) UserAttr {
	return func(model *UserModel) { model.Province = province }
}

func WithCity(city string) UserAttr {
	return func(model *UserModel) { model.City = city }
}

func WithCounty(county string) UserAttr {
	return func(model *UserModel) { model.County = county }
}

func WithRegionIds(regionids string) UserAttr {
	return func(model *UserModel) { model.RegionIds = regionids }
}

func WithIsSteward(isSteward uint8) UserAttr {
	return func(model *UserModel) { model.IsSteward = isSteward }
}

func WithModule(module string) UserAttr {
	return func(model *UserModel) { model.Module = module }
}

func WithPlatform(platform string) UserAttr {
	return func(model *UserModel) { model.Platform = platform }
}
